﻿// Enumeration. More on Object.freeze http://stackoverflow.com/questions/287903/enums-in-javascript/5040502#5040502
var GemColor = Object.freeze({
    "Black": 1,
    "Green": 2,
    "Pink": 3,
    "White": 4,
    "Red": 5,
    "Blue": 6,
    "Purple": 7,
    "Orange": 8,
    getKey: function (value) {
        for (var key in this) {
            if (this[key] == value) {
                return key;
                console.log(key);
            }
        }
        return null;
    },
    parseColor: function (color) {
        var firstUpper = color[0].toUpperCase();
        var theRest = color.substring(1, color.length);

        return this[firstUpper + theRest];
    }
});